/**
 *
 */
package xj.toolkit.netty.handler.codec.http.request;

import io.netty.handler.codec.http.DefaultFullHttpRequest;
import io.netty.handler.codec.http.FullHttpRequest;
import xj.toolkit.util.DefaultPropertiesSupport;
import xj.toolkit.util.MutablePropertyable;

import java.util.Map;

/**
 * @author hp
 */
@SuppressWarnings("hiding")
public class HttpRequestExt<Object> extends DefaultFullHttpRequest
		implements MutablePropertyable<String, Object>, FullHttpRequest {
	
	private DefaultPropertiesSupport<Object> propertiesSupport = new DefaultPropertiesSupport<Object>();

	@SuppressWarnings("deprecation")
	public HttpRequestExt(FullHttpRequest request) {
		super(request.getProtocolVersion(), request.getMethod(), request.getUri(), request.content());
		headers().set(request.headers());
		trailingHeaders().set(request.trailingHeaders());
	}

	@Override
	public Object getProperty(String key) {
		return propertiesSupport.getProperty(key);
	}

	@Override
	public Map<String, Object> getProperties() {
		return propertiesSupport.getProperties();
	}

	@Override
	public void setProperty(String key, Object value) {
		propertiesSupport.setProperty(key, value);
	}

	@Override
	public void setProperties(Map<String, Object> properties) {
		propertiesSupport.setProperties(properties);
	}
}
